<template>
	<view class="content">
		<view class="list"v-for="(item, index) in list" :key="index">
			<view class="item">
				<view class="base">
					<image v-if="item.avatarUrl != null && item.avatarUrl.length>0"  class="ele logImg" :src="item.avatarUrl"></image>
					<image v-else class="ele logImg" src="../../../static/img/my/default-logo.png"></image>
					<view  v-if="item.nickName != null && item.nickName.length>0"  class="ele nickName">{{item.nickName}}</view>
					<view v-else class="ele nickName">待授权</view>
					<view class="ele level">{{item.levelName}}</view>
				</view>
				<view class="t">
					{{item.createTime}}
				</view>
			</view>
		</view>
		<view class="noMore" v-show="isNoMore">暂无更多数据...</view>
		<!-- <view @click="toInviteFriend" class="toInvite"><text class="toInviteTxt">邀请好友</text></view> -->
	</view>
</template>

<script>
	export default{
		data(){
			return{
				isNoMore:false,
				page:1,
				list:[]
			}
		},
		onShow() {
			this.list=[];
			this.getData(1);
		},
		methods:{
			toInviteFriend(){
				uni.navigateTo({
					url: '../share/share'
				});
			},
			getData(page){
				let opts = {
					url: 'myMyFriend/getMyFriend/'+page,
					method: 'get'
				};
				let param = {};
				this.tokenRequest(opts, param).then(res => {
					uni.hideLoading();
					let rData = res.data;
					if(rData.length ==0){
						uni.showToast({
							title: '暂无更多数据...',
							mask: true,
							icon: 'none',
							duration: 1500
						})
						this.isNoMore = true;
						return;
					}
					for (let i = 0; i < rData.length; i++) {
						this.list.push(rData[i]);
					}
				}, error => {})
			}
		},onReachBottom() {
			this.page++;
			this.getData(this.page);
		}
	} 
</script>

<style>
	.item{
		background-color: #fff;
		padding: 20rpx;
		margin-top: 10rpx;
	}
	image{
		width: 100rpx;
		height: 100rpx;
	}
	.base{
		overflow: hidden;
		margin-bottom: 20rpx;
	}
	.base .ele{
		float: left;
		line-height: 100rpx;
	}
	.toInvite{
		text-align:center;
		position: fixed;
		bottom: 50rpx;
		width: 700rpx;
		margin-left: 25rpx;
		border-radius: 10rpx;
		background-color:#007AFF;
		padding: 20rpx 0;
	}
	.toInviteTxt{
		font-size: 30rpx;
		color: #fff;
	}
	.base .nickName{
		width: 460rpx;
		margin: 0 20rpx;
		overflow: hidden;
		white-space: nowrap;
		text-overflow: ellipsis;
	}
	.base .level{
		font-size: 35rpx;
		font-weight: 800;
		color: #007AFF;
	}
	.t{
		text-align: right;
		font-size: 28rpx;
		color: #999999;
	}
</style>